package controller;
import model.*;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 评价;
 * Created by yvdedu.com on 2016/9/27.
 */
@WebServlet(urlPatterns = "/option")
public class opinion extends HttpServlet{
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setCharacterEncoding("utf-8");
        req.setCharacterEncoding("utf-8");
        String book_id=req.getParameter("book_id");
        String user_id=req.getParameter("user_id");
        String option=req.getParameter("option");
        String score=req.getParameter("score");
        if(book_id!=null&&user_id!=null&&option!=null&&score!=null){
            MySql mysql=new MySql();
            Boolean result=mysql.addOption(Integer.parseInt(book_id),Integer.parseInt(user_id),option,Integer.parseInt(score));
            resp.getWriter().print(result);
        }
    }
}
